/*
 *  Copyright 2012 Dirk Vranckaert
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package eu.vranckaert.vvl.model;

import android.test.AndroidTestCase;

/**
 * User: DIRK VRANCKAERT
 * Date: 23/02/12
 * Time: 8:06
 */
public class TrafficInfoTextEnumTest extends AndroidTestCase {
    public void testMainClass() {
        TrafficInfoTextEnum t = new TrafficInfoTextEnum();
        assertNotNull(t);
    }

    public void testInformationType() {
        TrafficInfoTextEnum.InformationType[] values = TrafficInfoTextEnum.InformationType.values();
        for (TrafficInfoTextEnum.InformationType value : values) {
            String enumValue = value.getValue();

            TrafficInfoTextEnum.InformationType enumByValue = TrafficInfoTextEnum.InformationType.getByValue(enumValue);
            assertNotNull(enumByValue);
            assertEquals(value, enumByValue);
        }

        TrafficInfoTextEnum.InformationType enumByValue = TrafficInfoTextEnum.InformationType.getByValue("AZERTY_QWERTY");
        assertNull(enumByValue);
    }

    public void testRegion() {
        TrafficInfoTextEnum.Region[] values = TrafficInfoTextEnum.Region.values();
        for (TrafficInfoTextEnum.Region value : values) {
            int enumValue = value.getValue();

            TrafficInfoTextEnum.Region enumByValue = TrafficInfoTextEnum.Region.getByValue(enumValue);
            assertNotNull(enumByValue);
            assertEquals(value, enumByValue);
        }

        TrafficInfoTextEnum.Region enumByValue = TrafficInfoTextEnum.Region.getByValue(999998);
        assertNull(enumByValue);
    }

    public void testHighroad() {
        int exptedResult = 21;

        TrafficInfoTextEnum.Highroad highroad21 = TrafficInfoTextEnum.Highroad.Highroad_21;

        assertNotNull(highroad21);
        assertEquals(exptedResult, highroad21.getValue());
    }

    public void testSecondaryRoads() {
        int exptedResult = 84;

        TrafficInfoTextEnum.SecondaryRoads secondaryRoad84 = TrafficInfoTextEnum.SecondaryRoads.SecondaryRoad_84;

        assertNotNull(secondaryRoad84);
        assertEquals(exptedResult, secondaryRoad84.getValue());
    }
}
